<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>

</body>

<script>
  function a() {
    if (arguments.length == 3) {
      return arguments[0] + arguments[1] + arguments[2]
    }

    if (arguments.length == 1) {
      var arg1 = arguments[0]
      return function () {
        var agr2 = arguments[0]
        return function () {
          return arg1 + agr2 + arguments[0]
        }
      }
    }

  }

  // console.log(a(1,3,))
  console.log(a(1)(2)(3))

</script>

</html>